package com.wt.springsamples.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wt.springsamples.biz.service.IOrderService;
import com.wt.springsamples.biz.service.IOrgService;
import com.wt.springsamples.common.ApiResult;
import com.wt.springsamples.model.OrderEntity;
import com.wt.springsamples.model.Org;
import com.wt.springsamples.model.dto.OrgTreeNode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/order")
public class OrderController {

    @Autowired
    private IOrderService orderService;

    @ApiOperation(value = "org:view",nickname ="组织管理-查看")
    @GetMapping("/{id}")
    public ApiResult getById(@PathVariable Long id){

        OrderEntity order = orderService.getById(id);
        return ApiResult.ok(order);
    }

    @GetMapping("/findAll")
    public ApiResult findAll(){
        List<OrderEntity> list = orderService.listAll();
        return  ApiResult.ok(list);
    }

}
